package com.huifai.config;


import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Properties;

/**
 * <br>==========================
 * <br> 开发：jerry
 * <br> 创建时间：2019-6-02 下午4:19
 * <br> 版本：1.0
 * <br> 描述：MybatisPlus框架配置
 * <br>==========================
 */
@Configuration
@MapperScan("com.huifai.mapper*")
public class MybatisPlusConfig {

	/**
	 *	 mybatis-plus分页插件
	 */
	@Bean
	public PaginationInterceptor paginationInterceptor() {
		return new PaginationInterceptor();
	}

	@Bean
	public OptimisticLockerInterceptor optimisticLockerInterceptor() {
		OptimisticLockerInterceptor optimisticLockerInterceptor = new OptimisticLockerInterceptor();
		return optimisticLockerInterceptor;
	}

	/**
	 * 查看SQL运行时间
	 * @return
	 */
	@Bean
	public PerformanceInterceptor performanceInterceptor() {
		return new PerformanceInterceptor();
	}
}
